//超声波传感器引脚初始化
void ultrasonic_init(){
  pinMode(Trig, OUTPUT);
  pinMode(Echo, INPUT);
}


//获取超声波传感器距离函数
float get_value(int trig, int echo){
  //发送一个10us的脉冲
  digitalWrite(trig, LOW);
  delayMicroseconds(2);
  digitalWrite(trig, HIGH);
  delayMicroseconds(10);
  digitalWrite(trig, LOW);
  float Time2 = pulseIn(echo, HIGH);
  //计算距离
  distance =  Time2 / 58; //单位厘米 distance = Time1*340*100/1000000/2;
  return distance;
}